package practice;

import java.util.Scanner;

public class getEmailName {
    public static void main(String[] args) {
        System.out.println("请输入email地址：");
        String e=new Scanner(System.in).nextLine();

        System.out.println(getEmail(e));
    }

    private static String getEmail(String e) {
        int index=e.indexOf("@");
        if (index==-1){
            return  "邮箱格式错误";
        }
        return e.substring(0,index);
    }
}
